<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>系统管理</title>
  {include file="common/_require"}

  <script>
    var currentHeaderNavItem = 'System';
    var currentLeftNavItem = 'index';
  </script>
</head>

<body class="layui-layout-body">

  <div class="layui-layout layui-layout-admin">
    {include file="common/_header"}

    {include file="common/left_system"}

    <div class="layui-body">

      <div style="padding:15px">
        <div class="main-header">
          <span class="layui-breadcrumb">
            <a>首页</a>
            <a><cite>系统设置</cite></a>
          </span>
        </div>
        <div class="main-container">
          <div class="layui-col-md6">
            <fieldset class="layui-elem-field">
              <legend>系统管理</legend>
              <div class="layui-field-box">
                <form class="layui-form" action="{:url('admin/System/update')}" method="post">
                  <div class="layui-form-item">
                    <div class="layui-form-label">网站名称</div>
                    <div class="layui-input-block">
                      <input type="text" name="site_name" value="{:get_system_config('site_name')}" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">网站描述</div>
                    <div class="layui-input-block">
                      <textarea name="site_desc" class="layui-textarea">{:get_system_config('site_desc')}</textarea>
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">网站logo</div>
                    <div class="layui-input-block">
                      <div>
                        <div class="layui-btn upload-site-logo">上传logo</div>
                      </div>
                      <div>
                        <img class="site-logo" style="max-width: 200px;"
                          src="{:get_source_link(get_system_config('site_logo'))}" alt="">
                      </div>
                      <input type="hidden" name="site_logo" value="{:get_system_config('site_logo')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">联系电话</div>
                    <div class="layui-input-block">
                      <input type="text" name="site_contact_phone" value="{:get_system_config('site_contact_phone')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">积分名称</div>
                    <div class="layui-input-block">
                      <input type="text" name="credit_title" value="{:get_system_config('credit_title')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">工作时间</div>
                    <div class="layui-input-block">
                      <input type="text" name="site_worktime" value="{:get_system_config('site_worktime')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">联系邮箱</div>
                    <div class="layui-input-block">
                      <input type="text" name="stie_contact_email" value="{:get_system_config('stie_contact_email')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">富文本上传图片限制<a href="https://cunchu.51240.com/" target="_blank" class="layui-word-aux">单位字节</a></div>
                    <div class="layui-input-block">
                      <input type="text" name="post_upload_limit" value="{:get_system_config('post_upload_limit')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">二维码</div>
                    <div class="layui-input-block">
                      <div>
                        <div class="layui-btn upload-site-qrcode">上传二维码</div>
                      </div>
                      <div>
                        <img class="site-qrcode" style="max-width: 200px;"
                          src="{:get_source_link(get_system_config('site_qrcode'))}" alt="">
                      </div>
                      <input type="hidden" name="site_qrcode" value="{:get_system_config('site_qrcode')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">站点fovicon</div>
                    <div class="layui-input-block">
                      <div>
                        <div class="layui-btn upload-site-fovicon">上传fovicon</div>
                      </div>
                      <div>
                        <img class="site-fovicon" style="max-width: 200px;"
                          src="{:get_source_link(get_system_config('site_favicon'))}" alt="">
                      </div>
                      <input type="hidden" name="site_favicon" value="{:get_system_config('site_favicon')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">主域名</div>
                    <div class="layui-input-block">
                      <input type="text" name="main_domain" value="{:get_system_config('main_domain')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">资源域名</div>
                    <div class="layui-input-block">
                      <input type="text" name="resource_domain" value="{:get_system_config('resource_domain')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-form-label">上传地址前缀</div>
                    <div class="layui-input-block">
                      <input type="text" name="upload_address_prefix" value="{:get_system_config('upload_address_prefix','/index/')}"
                        class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item layui-form-text">
                    <div class="layui-form-label">统计代码</div>
                    <div class="layui-input-block">
                      <textarea name="site_tongji" class="layui-textarea">{:get_system_config('site_tongji')}</textarea>
                    </div>
                  </div>
                  
                  <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">保存</button>
                  </div>
                </form>
              </div>
            </fieldset>

          </div>
        </div>
      </div>
    </div>


    {include file="common/_footer"}

    <script>
      layui.use(['layer', 'upload'], function () {
        var upload = layui.upload;


        var uploadSiteLogo = upload.render({
          elem: '.upload-site-logo',
          url: '{:url("File/save")}',
          data: {
            type: 1,
            dir: 'site_logo'
          },
          accept: 'images',
          done: function (result) {
            if (result.code == 0) {
              layer.msg('上传成功');
              $('input[name="site_logo"]').val(result.data.save_name);
              $('.site-logo').attr('src', result.data.src);
            } else {
              layer.msg(result.msg)
            }
          }
        })
        var uploadSiteLogo = upload.render({
          elem: '.upload-site-qrcode',
          url: '{:url("File/save")}',
          data: {
            type: 1,
            dir: 'site_logo'
          },
          accept: 'images',
          done: function (result) {
            if (result.code == 0) {
              layer.msg('上传成功');
              $('input[name="site_qrcode"]').val(result.data.save_name);
              $('.site-qrcode').attr('src', result.data.src);
            } else {
              layer.msg(result.msg)
            }
          }
        })
        var uploadSiteLogo = upload.render({
          elem: '.upload-site-fovicon',
          url: '{:url("File/save")}',
          data: {
            type: 1,
            dir: 'site_logo'
          },
          accept: 'images',
          acceptMime:'image/x-icon',
          exts:'ico',
          done: function (result) {
            if (result.code == 0) {
              layer.msg('上传成功');
              $('input[name="site_favicon"]').val(result.data.save_name);
              $('.site-fovicon').attr('src', result.data.src);
            } else {
              layer.msg(result.msg)
            }
          }
        })

      })
    </script>
  </div>`
</body>

</html>